"""
临时认证模块 - 用于测试
"""
from fastapi import Depends, HTTPException, status
from sqlalchemy.orm import Session
from app.database import get_db
from app.models.user import User

# 临时测试用户ID
TEST_USER_ID = 1

def get_current_user(db: Session = Depends(get_db)) -> User:
    """
    获取当前用户 - 临时实现
    在正式部署前需要实现真正的JWT认证
    """
    # 临时返回测试用户
    user = db.query(User).filter(User.id == TEST_USER_ID).first()
    if not user:
        # 创建测试用户
        user = User(
            id=TEST_USER_ID,
            username="test_user",
            email="test@example.com",
            password_hash="temp_hash"
        )
        db.add(user)
        db.commit()
        db.refresh(user)
    
    return user 